package com.dfkj.wmswcs.controller;

import com.dfkj.wmswcs.common.BaseResponse;
import com.dfkj.wmswcs.model.domain.WcsPallet;
import com.dfkj.wmswcs.model.domain.WcsPalletNumber;
import com.dfkj.wmswcs.model.dto.*;
import com.dfkj.wmswcs.service.WmsToWcsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("api/wms")
@Api(tags = "WMS推送给WCS")
public class WmsToWcsController {


    @Resource
    private WmsToWcsService wmsToWcsService;

    @ApiOperation("WMS发送堆垛机任务给WCS")
    @GetMapping("/setStackerTask")
    public BaseResponse setStackerTask() {

        return wmsToWcsService.setStackerTask();

    }


    @ApiOperation("修改WMS任务状态")
    @PostMapping("/changeTaskStatus")
    public BaseResponse changeTaskStatus(@RequestBody WmsTaskChangeDto changeDto){

        return wmsToWcsService.changeTaskStatus(changeDto);

    }


    @ApiOperation("WCS反馈WMS任务状态")
    @PostMapping("/wcsUpdateWms")
    public BaseResponse wcsUpdateWms(@RequestBody WcsTaskChangeDto changeDto){

        return wmsToWcsService.wcsUpdateWms(changeDto);


    }

    @ApiOperation("WCS请求载具入库")
    @PostMapping("/wcsRequestwarehouse")
    public BaseResponse wcsRequestwarehouse(@RequestBody WcsRequestWarehoseDto dto){

        return wmsToWcsService.wcsRequestwarehouse(dto);

    }


    @ApiOperation("WMS向WCS推送新的目的地")
    @PostMapping("/setStackerTaskNewDestination")
    public BaseResponse setStackerTaskNewDestination(@RequestBody WmsTaskNewDestinationDto dto){

        return wmsToWcsService.setStackerTaskNewDestination(dto);

    }


    @ApiOperation("箱式线--WMS向WCS发送输送任务")
    @PostMapping("/setConveyTask")
    public BaseResponse setConveyTask(@RequestBody WmsConveyTaskDto conveyTaskDto){

       return wmsToWcsService.setConveryTask(conveyTaskDto);

    }

    @ApiOperation("箱式线--WCS向WMS上报箱子到达")
    @PostMapping("/wcsComeLocation")
    public BaseResponse wcsComeLocation(@RequestBody WcsConveyTaskChangeDto changeDto){

        return wmsToWcsService.wcsComeLocation(changeDto);

    }


    @ApiOperation("箱式线--WMS请求输送线释放箱子")
    @PostMapping("/releaseBox")
    public BaseResponse releaseBox(@RequestBody LocationDto dto){

        return wmsToWcsService.releaseBox(dto);

    }


    @ApiOperation("WMS推送箱数据信息到WCS")
    @PostMapping("/wmsToWcsBarCode")
    public BaseResponse wmsTowcsBarCode(){

        return wmsToWcsService.wmsToWcsBarCode();

    }

    @ApiOperation("机械手抓取工位反馈WMS")
    @PostMapping("/BoxFinish")
    public BaseResponse boxFinish(@RequestBody List<WcsPalletDto> palletDtos){

        return wmsToWcsService.boxFinish(palletDtos);

    }

    @ApiOperation("拆盘机补空托盘")
    @PostMapping("/EmptyPalletNumber")
    public BaseResponse boxFinish(@RequestBody WcsPalletNumberDto palletNumberDto){

        return wmsToWcsService.emptyPalletNumber(palletNumberDto);

    }








}
